package com.xmg.boot.demo.bootcommon.utils.enums;

/**
 * @author: ma
 * @date: 2023-12-04
 * @since: 定义枚举
 */

public enum StatusCode {
    OK("200","成功"),
    ERROR("403","失败");

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    private String code;
    private String value;

    StatusCode(String code, String value){
        this.code=code;
        this.value=value;
    }

    public static String getValueByKey(String key) {
        for (StatusCode item : StatusCode.values()) {
            if (item.name().equalsIgnoreCase(key)) {
                return item.getValue();
            }
        }
        return null;
    }
}
